import { Injectable, Injector } from '@angular/core';
import { Constant, ServiceResult } from '@core/constant';
import {_HttpClient, SettingsService} from '@delon/theme';
import { MyHttpClient } from '../MyHttpClient';

@Injectable()
export class sysqmService {
  get cnt(): Constant {
    return this.injector.get(Constant);
  }
  constructor(
    private injector: Injector,
    private http: _HttpClient,
    private myHttp: MyHttpClient,
    public setting: SettingsService,

  ) {}

  /**
   * 分页获取商品
   */
  list(): string {
    return `${this.cnt.baseUrl}/rest/sapEkpoFhController/list/`+this.setting.user.username;
  }
  /**
   * 分页获取商品
   */
  listxh(): string {
    return `${this.cnt.baseUrl}/rest/sapEkpoFhController/listxh/`+this.setting.user.username;
  }
  /**
   * 修改商品
   * @param product
   */
  batcheditPro(saptype,vbeln,product) {
    return this.http.post(
      `${this.cnt.baseUrl}/rest/sapEkpoFhController/`+saptype+'/'+vbeln+"/"+this.setting.user.username,
      product,
    );
  }


  getlist(vbeln,xianghao,type,matnr) {
    return this.http.get(
       this.listxh()+'/xianghao'+"?xianghaoid="+xianghao+"&dotype="+type+"&matnr="+matnr,
    );
  }
  getlistvbeln(vbeln,xianghao,type,matnr,xianghaop) {
    return this.http.get(
      this.list()+'/'+vbeln+"?xianghaoid="+xianghao+"&dotype="+type+"&matnr="+matnr+"&xianghao="+xianghaop,
    );
  }

  getqmlist(buseid,qmtype) {
    return this.http.get(
      this.cnt.baseUrl + '/rest/qmBuseController/list' + "/" + this.setting.user.username + "?buseid=" + buseid + "&qmtype=" + qmtype,
    );
  }
    saveqmlist(qmlist,buseid,qmtype){
      return this.http.post(
        `${this.cnt.baseUrl}/rest/qmBuseController/srmqm`+"/"+this.setting.user.username+ "?buseid=" + buseid + "&qmtype=" + qmtype,
        qmlist,
      );
  };

}
